<?php include_once("common.php");
class Category extends BaseEntity implements BaseOperations
{
	private $category;
	
	// PROPERTIES
	public function getLabel()
	{
		return $this->category;
	}
	
	public function setLabel($label)
	{
		$this->category = $label;
	}

	// METHODS
	public function GetRecordById($id)
	{
		$res = mysql_query("SELECT * FROM categories WHERE id = ".$id);
		
		$f = mysql_fetch_array($res);
				
		$tmp = new Category;
		$tmp->setId($f[id]);
		$tmp->setLabel($f[label]);
		
		return $tmp;
	}
	
	public function GetAllRecords()
	{
		$result = array();
			
		$res = mysql_query("SELECT * FROM categories;");
		
		for ($c=0; $c<mysql_num_rows($res); $c++)
		{
			$f = mysql_fetch_array($res);
			
			$tmp = new Category;
			$tmp->setId($f[id]);
			$tmp->setLabel($f[label]);
			
			$result[] = $tmp;
		}
		
		return $result;
	}

	public function AddNewRecord()
	{
		// should be implemented
	}
	
	public function UpdateRecord()
	{
		// should be implemented
	}
	
	public function RemoveRecordById($id)
	{
		// should be implemented
	}
}
?>